<template>
  <div>
    <div class="ele-page-header">
      <div class="ele-page-title">阿里云短信配置</div>
      <div class="ele-page-desc">
        阿里云短信配置
      </div>
    </div>
    <div class="ele-body">
      <el-card shadow="never">
        <el-form
          ref="form"
          :model="form"
          :rules="rules"
          label-width="120px"
          style="max-width: 700px; margin: 10px auto"
        >

        

          <el-form-item  label="公钥信息:" prop="alimessage_access_key_id">
            <el-input v-model="form.alimessage_access_key_id" placeholder="请输入" clearable />

          </el-form-item>
          <el-form-item  label="私钥信息:" prop="alimessage_access_key_secret">
            <el-input v-model="form.alimessage_access_key_secret" placeholder="请输入" clearable />
    
          </el-form-item>

          <el-form-item  label="签名名称:" prop="alimessage_template_name">
            <el-input v-model="form.alimessage_template_name" placeholder="" clearable />
           
          </el-form-item>

          <el-form-item label="模板id:" prop="alimessage_tid">
            <el-input v-model="form.alimessage_tid"  show-password placeholder="" clearable />
         XXX 验证码${code}XXXXXX！    
          </el-form-item> 
           
          <el-form-item>
            <el-button type="primary" :loading="loading" @click="submit">
              提交
            </el-button>
          </el-form-item>
        </el-form>
      </el-card>
    </div>
  </div>
</template>

<script>
  import { messageConfigSave ,messageConfigQuery } from '@/api/platform';
  export default {
    name: 'SysUpload',
    data() {
      return {
        // 提交状态
        loading: false,
        // 表单数据
        form: {
      
          alioss_access_key_id: '',
          alioss_access_key_secret: '',
         alioss_access_key_secret: '',
           alimessage_tid: '',
    
      
        },

        // 表单验证规则
        rules: {
         
        },
        
      };
    },
    methods: {
      /* 提交 */
      submit() {
        this.$refs['form'].validate((valid) => {
          if (valid) {
            this.loading = true;
          this.loading = true;
          messageConfigSave(this.form)
            .then((msg) => {
              this.loading = false;
              this.$message.success(msg);
            })
            .catch((e) => {
              this.loading = false;
              this.$message.error(e.message);
            });


          } else {
            return false;
          }
        });
      },
   
    },
     mounted() {
           messageConfigQuery({group:'upload'})
            .then((msg) => {
             if(msg != null){
                this.form = msg;  
              }
              
            })
            .catch((e) => {
              this.$message.error(e.message);
            });
     }
    
  };
</script>

<style scoped>
.el-form-item{
  margin-left: 100px;
}
</style>
